package org.lucky.admin.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.lucky.admin.mapper.AdminMapper;
import org.lucky.admin.mapper.MenuMapper;
import org.lucky.admin.service.IMenuService;
import org.lucky_common.domain.Admin;
import org.lucky_common.domain.Menu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IMenuService{
    @Resource
    private MenuMapper mapper;
    @Resource
    private AdminMapper adminMapper;
    @Override
    public List<Menu> getEmployeeMenu(Long id) {
        Admin employee = adminMapper.queryByLoginInfoId(id);
        if (employee != null) {
            return mapper.getEmployeeMenu(employee.getId());
        }
        return mapper.getEmployeeMenu(id);
    }
}
